﻿module ClassAdvancedTechniquests{
//深入理解TypeScript->javascirpt
/*
class Greeter {
    greeting: string;
    constructor(message: string) {
        this.greeting = message;
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}
var greeter: Greeter;
greeter = new Greeter("world");
alert(greeter.greet());
//以上代码转换为js为
var Greeter = (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
})();

var greeter;
greeter = new Greeter("world");
alert(greeter.greet());
*/
class Greeter1 {
    static standardGreetng = "Hello,there";
    greeting: string;
    greet() {
        if (this.greeting) {
            return "Hello ," + this.greeting;
        }
        else {
            return Greeter1.standardGreetng;
        }
    }
}
var greeter1: Greeter1;
greeter1 = new Greeter1();
alert(greeter1.greet());

var greeterMaker: typeof Greeter1 = Greeter1;
greeterMaker.standardGreetng = "Hey there!";
var greeter2: Greeter1 = new greeterMaker();
alert(greeter2.greet());

var s = Greeter1;
alert(new s().greet());
//(Using a class as an interface)将类用做接口
class Point {
    x: number;
    y: number;
}
interface Point3d extends Point {
    z: number;
}
var point3d: Point3d = { x: 1, y: 2, z: 3 };
 }